package com.wpf.test01;

public class demo01 {
    public static void main(String[] args) {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        try {
//            Date d = sdf.parse("2019-11-11 10:23:11");
//        } catch (ParseException e) {
//            throw new RuntimeException(e);
//        }
        try {
            saveAge(223);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("culaba");
        }


        try {
            saveAge(223);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("culaba");
        }


    }

    public static void saveAge(int age) throws AgefeifaException {
        if(age > 0 && age <150){
            System.out.println("年龄正确");
        }else{
            // 抛出运行时异常
//            throw new AgefeifaRuntimeException("/年龄非法"+age);

            // 抛出编译时异常
            throw new AgefeifaException("/年龄非法"+age);
        }
    }

}
